package com.ostrich.note.ui.settings.views;

import androidx.appcompat.app.AppCompatActivity;
import androidx.lifecycle.Observer;
import androidx.lifecycle.ViewModelProvider;

import android.os.Bundle;
import android.view.View;

import com.blankj.utilcode.util.ToastUtils;
import com.ostrich.note.R;
import com.ostrich.note.base.BaseMvvmActivity;
import com.ostrich.note.databinding.ActivitySettingsOpinionBinding;
import com.ostrich.note.entity.BaseResponseEntity;
import com.ostrich.note.ui.settings.entity.OptionEntity;
import com.ostrich.note.ui.settings.viewmodel.SettingsOpinionViewModel;

public class SettingsOpinionActivity extends BaseMvvmActivity<ActivitySettingsOpinionBinding, SettingsOpinionViewModel> {


    @Override
    protected void iniView() {

    }

    @Override
    public int getLayout() {
        return R.layout.activity_settings_opinion;
    }

    @Override
    public void initData() {

    }

    @Override
    public void initListener() {
        binding.tvSubmit.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                viewModel.appConfigGetOne().observe(SettingsOpinionActivity.this, new Observer<BaseResponseEntity<OptionEntity>>() {
                    @Override
                    public void onChanged(BaseResponseEntity<OptionEntity> optionEntityBaseResponseEntity) {
                        if(optionEntityBaseResponseEntity.getCode() == 200){
                            ToastUtils.showShort("提交成功");
                        }
                    }
                });
            }
        });
        binding.clBack.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                finish();
            }
        });

    }

    @Override
    public void createViewModel() {
        viewModel = new ViewModelProvider(this).get(SettingsOpinionViewModel.class);
    }
}